package logic

import (
	"context"
	"learning-pass/common/proto/user"
	"learning-pass/service/server"
)

type ServerUser struct {
	user.UnimplementedUserServer
}

func (s ServerUser) Login(ctx context.Context, in *user.LoginReq) (*user.LoginResp, error) {
	login, err := server.Login(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}
func (s ServerUser) Register(ctx context.Context, in *user.RegisterReq) (*user.RegisterResp, error) {
	register, err := server.Register(in)
	if err != nil {
		return nil, err
	}
	return register, nil
}
func (s ServerUser) AddUserStudyPlan(ctx context.Context, in *user.AddUserStudyPlanReq) (*user.AddUserStudyPlanResp, error) {
	plan, err := server.AddUserStudyPlan(in)
	if err != nil {
		return nil, err
	}
	return plan, nil
}
func (s ServerUser) DelUserStudyPlan(ctx context.Context, in *user.DelUserStudyPlanReq) (*user.DelUserStudyPlanResp, error) {
	plan, err := server.DelUserStudyPlan(in)
	if err != nil {
		return nil, err
	}
	return plan, nil
}
func (s ServerUser) CreateOrder(ctx context.Context, in *user.CreateOrderReq) (*user.CreateOrderResp, error) {
	order, err := server.CreateOrder(in)
	if err != nil {
		return nil, err
	}
	return order, nil
}
